//
//  XJSerachGoodsCell.m
//  XinJiangMall
//
//  Created by RaoBo on 2018/7/4.
//  Copyright © 2018年 Tzyang. All rights reserved.
//

#import "XJSerachGoodsCell.h"

@interface XJSerachGoodsCell()
@property (weak, nonatomic) IBOutlet UIImageView *iconIv;
@property (weak, nonatomic) IBOutlet UILabel *nameLb;
@property (weak, nonatomic) IBOutlet UILabel *priceLb;
@property (weak, nonatomic) IBOutlet UILabel *marketPriceLb;

@end

@implementation XJSerachGoodsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.iconIv.layer.masksToBounds = YES;
    self.iconIv.layer.cornerRadius = 10;
}


- (void)setModel:(XJSearchGoodsModel *)model {
    
    NSURL *iconURL = [NSURL URLWithString:model.cover];
    
    UIImage *placehoderImg = [UIImage imageNamed:@"default_goods"];
    
    [self.iconIv sd_setImageWithURL:iconURL placeholderImage:placehoderImg];
    self.nameLb.text = model.name;
    
    
    NSString *price = [NSString stringWithFormat:@"￥ %.2f",[model.price floatValue]];
    self.priceLb.text = price;
    
    
    // 中划线
    NSString *marktePrice = [NSString stringWithFormat:@"%.2f",[model.market_price floatValue]];
    NSDictionary *attDic = @{NSStrikethroughStyleAttributeName:[NSNumber numberWithInteger:NSUnderlineStyleSingle]};
    NSAttributedString *attributeStrM = [[NSAttributedString alloc] initWithString:marktePrice attributes:attDic];
    self.marketPriceLb.attributedText = attributeStrM;
}


@end
